home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / guardtower_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  5.4 KB  |  147 lines

  1.  
  2. function units_guardtower_alien_setup()
  3.     units_setup(9,true,ENET_EFFECT_PS_SETUPSMOKE_SMALL,ENET_EFFECT_GEOMETRY_GUARDTOWERALIENSHADOW)
  4. end
  5.  
  6. function units_guardtower_alien_resetup()
  7.     units_setup(9,true,nil,ENET_EFFECT_GEOMETRY_GUARDTOWERALIENSHADOW)
  8. end
  9.  
  10. function units_guardtower_alien_select()
  11.     units_select(22,4)
  12. end
  13.  
  14. function units_guardtower_alien_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_guardtower_alien_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_guardtower_alien_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_guardtower_alien_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_guardtower_alien_explode()
  31.     units_explode_big1()
  32. end
  33.  
  34. function units_guardtower_alien_move()
  35. end
  36.  
  37. function units_guardtower_alien_fire()
  38.     local unit = uniGetExecutor()
  39.     uniSetLife(uniGetLife() / 4.0)
  40.     local gt = unit:getBone(ENBT_GUNTOWER)
  41.     local sound = gt:play3DSound("guardtower_alien_guntower_rotate.wav",1)
  42.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI / 2.0,uniGetTarget()))
  43.     sound:stopSound()
  44.     local firespots = {}
  45.     firespots[0] = gt:getBone(ENBT_FIRE1,0)
  46.     firespots[1] = gt:getBone(ENBT_FIRE1,1)
  47.     local gun = gt:getBone(ENBT_GUN)
  48.     waitDeath(gun:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
  49.  
  50.     local i
  51.     for i = 0,1 do
  52.         firespots[0]:addBulletEffect(ENET_EFFECT_BULLET_BLUESPIRALLASERBOLT):executeCommand(ENC_FIRE1)
  53.         pause(0.2)
  54.         gt:gunRecoil(0,0.4,30)
  55.  
  56.         firespots[1]:addBulletEffect(ENET_EFFECT_BULLET_BLUESPIRALLASERBOLT):executeCommand(ENC_FIRE1)
  57.         pause(0.2)
  58.         gt:gunRecoil(1,0.4,30)
  59.     end
  60.  
  61.     unit:addFireArrow()
  62. end
  63.  
  64. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_MOVE,"units_guardtower_alien_move")
  65. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_FIRE1,"units_guardtower_alien_fire")
  66. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_FIRE2,"units_guardtower_alien_fire")
  67. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_SELECT,"units_guardtower_alien_select")
  68. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_SELECTENEMY,"units_guardtower_alien_selectenemy")
  69. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_UNSELECT,"units_guardtower_alien_unselect")
  70. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_SETUP,"units_guardtower_alien_setup")
  71. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_RESETUP,"units_guardtower_alien_resetup")
  72. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_DAMAGED,"units_guardtower_alien_damaged")
  73. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_EXPLODE,"units_guardtower_alien_explode")
  74. registerCommand(ENSCRIPTSET_GUARDTOWER_ALIEN,ENC_HIGHLIGHT,"units_guardtower_alien_highlight")
  75.  
  76. -- make description of unit
  77. desc = getEffectDescriptionP(ENET_UNIT_GUARDTOWER_ALIEN)
  78. desc.ClassID = ENCLASS_MESHINSTANCE
  79. desc.EffectClassType = ENECT_GEOMETRY
  80. desc.FileName = "guardtower_alien.rmd"
  81. desc.ScriptSet = ENSCRIPTSET_GUARDTOWER_ALIEN
  82. desc.MoveType = ENMOVE_SWIM
  83. desc.RenderType = ENRENDERTYPE_GEOMETRY
  84. desc.Material = ENMAT_RIGIDSKINNEDMESH
  85. desc.MaterialColors = units_materialcolors_human
  86.  
  87. -- shadow
  88. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_GUARDTOWERALIENSHADOW)
  89. desc.ClassID = ENCLASS_MESHINSTANCE
  90. desc.EffectClassType = ENECT_GEOMETRY
  91. desc.FileName = "guardtower_alien_shadow.rmd"
  92. desc.RenderType = ENRENDERTYPE_SHADOW
  93. desc.Material = ENMAT_SHADOW
  94. desc.MaterialColors = units_materialcolors_shadow
  95.  
  96. -- register new unit to logic
  97. unitDesc = logic_getUnitDescP(18)
  98. unitDesc.group = 2
  99. unitDesc.order = 6
  100. unitDesc.unit_res_id = ENET_UNIT_GUARDTOWER_ALIEN
  101. unitDesc.unit_icon_id = "Guardtower_a_small_normal.dds"
  102. unitDesc.active_id = "Guardtower_a_small_active.dds"
  103. unitDesc.pressed_id = "Guardtower_a_small_pressed.dds"
  104. unitDesc.small_icon_id = "Guardtower_l_stats.dds"
  105. unitDesc.big_icon_id = "Guardtower_a_big_normal.dds"
  106. unitDesc.HP = 9
  107. unitDesc.MP = 0
  108. unitDesc.WR = 4
  109. unitDesc.min_WR = 1
  110. unitDesc.WD = 2
  111. unitDesc.WR2 = 0
  112. unitDesc.min_WR2 = 0
  113. unitDesc.WD2 = 0
  114. unitDesc.ability = 1
  115. unitDesc.transport = 0
  116. unitDesc.value = 4
  117. unitDesc.race = 1
  118. unitDesc.fire_pause = 0.75
  119. unitDesc.move_pause = 0.7
  120. unitDesc.unit_info_scale = 0.03
  121. unitDesc.scn_name = "GTOWERA"
  122.  
  123. ------------------------------------------------------------------------------------------------------
  124. ------------------------ effects related to unit------------------------------------------------------
  125. ------------------------------------------------------------------------------------------------------
  126.  
  127. function bullets_bluespirallaserbolt_fire()
  128.     local bullet = uniGetExecutor()
  129.     local sound = bullet:play3DSound("guardtower_alien_lightning_fire.wav",1)
  130.     local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_BLUESPIRALLASERBOLTFLY)
  131.     local track = bullet:addSimpleEffect(ENET_EFFECT_PS_BLUESPIRALLASERBOLTFLY)
  132.     track:suspend()
  133.     pause(0.1)
  134.     bullet:setTransformOwner()
  135.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,500,uniGetTarget()),1000)
  136.     sound:destroy()
  137.     light:destroy()
  138.     track:destroy()
  139.     bullet:addSimpleEffect(ENET_EFFECT_LIGHT_BLUESPIRALLASERBOLTHIT):delayedDestroy(1.0)
  140.     bullet:addSimpleEffect(ENET_EFFECT_PS_BLUESPIRALLASERBOLTHIT):suspendedDestroy(1.0)
  141.     uniGetTarget():executeCommand(ENC_DAMAGED)
  142.     pause(1.0)
  143.     bullet:destroy()
  144. end
  145.  
  146. registerCommand(ENSCRIPTSET_BULLET_BLUESPIRALLASERBOLT,ENC_FIRE1,"bullets_bluespirallaserbolt_fire")
  147.